package com.recSys.test;

/**
 * Created by dell on 2018/1/24.
 */
public class Salary {

    /**
     *
     * 年终奖
     * 返回应扣税额
     * @param sqnzj 想发的钱
     * @return
     */
    public static double NZJ(double sqnzj) {
        double X = sqnzj/12;
        if(X > 80000) {
            return sqnzj*0.45 - 13505;
        } else if(X > 55000) {
            return sqnzj*0.35 - 5505;
        } else if(X > 35000) {
            return sqnzj*0.3 - 2755;
        } else if(X > 9000) {
            return sqnzj*0.25 - 1005;
        } else if(X > 4500) {
            return sqnzj*0.2 - 555;
        } else if(X > 1500) {
            return sqnzj*0.1 - 105;
        } else {
            return sqnzj*0.03;
        }
    }

    /**
     * 工资
     * @param sqgz 税前工资
     * @return 应扣税
     */
    public static double GZ (double sqgz) {

        double X = sqgz - 3500;
        if(X > 80000) {
            return X*0.45 - 13505;
        } else if(X > 55000) {
            return X*0.35 - 5505;
        } else if(X > 35000) {
            return X*0.3 - 2755;
        } else if(X > 9000) {
            return X*0.25 - 1005;
        } else if(X > 4500) {
            return X*0.2 - 555;
        } else if(X > 1500) {
            return X*0.1 - 105;
        } else {
            return X*0.03;
        }
    }


    public static void main(String[] args) {
        double max = 0;
        for(int sqnzj = 1; sqnzj <= 150000; sqnzj++) {
            double shnzj = sqnzj - NZJ(sqnzj);
            double sqgz = (150000 - sqnzj) / 12;
            double shgz = sqgz - GZ(sqgz);
            double gzAll = shgz * 12;
            double sum = shnzj + gzAll;
            if(sum > max) {
                max = sum;
                System.out.println(sqnzj + " " + max);
            }
        }
    }
}
